from aiogram_dialog import Dialog, Window
from aiogram_dialog.widgets.kbd import Cancel, Start

from src.bot.dialogs.extras import copy_start_data_to_ctx
from src.bot.dialogs.getters.subscriptions import user_subscription_getter
from src.bot.dialogs.widgets import LocaleText
from src.bot.states.user import ManageSubscriptionSG, PaymentSG

subscription_info_window = Window(
    LocaleText("subscription-info"),
    LocaleText("start-date", start_date="{start_date}"),
    LocaleText("end-date", end_date="{end_date}"),
    Start(
        LocaleText("extend-subscription-btn"),
        id="extend_subscription",
        state=PaymentSG.select_payment_method,
    ),
    Cancel(LocaleText("back-btn")),
    getter=user_subscription_getter,
    state=ManageSubscriptionSG.subscription_info,
)


manage_subscription_dialog = Dialog(
    subscription_info_window,
    on_start=copy_start_data_to_ctx,
)
